f71066d5d32523ac45cf4600b03282594b5cbfc9,opennms-services/src/main/java/org/opennms/netmgt/config/KSC_PerformanceReportFactory.java,KSC_PerformanceReportFactory,loadWorkingReport,#number#,210

Before Change


     * one if the object does not exist
     */
    public void loadWorkingReport(int index) throws MarshalException, ValidationException {
        int total_reports = m_config.getReportCount();
        working_index = index;
        if ((working_index < 0) || (working_index >= total_reports)) {
            // Out of range. Assume new report needs to be created.
            working_report = KSC_PerformanceReportFactory.getNewReport();
            working_index = -1;
        } else {
            loadWorkingReport(m_config.getReport(working_index));
        }
    }

After Change


        setIdsOnAllReports();
    }

    void setReport(int index, Report report) {
        int arrayIndex = getArrayIndex(index);
        if (arrayIndex == -1) {
            throw new IllegalArgumentException("Could not find report with ID of " + index);
        }
        
        // Make sure we preserve the existing ID, if it exists (which it should)
        if (m_config.getReport(arrayIndex).hasId()) {
            report.setId(m_config.getReport(arrayIndex).getId());
        }
        
        m_config.setReport(arrayIndex, report);
        setIdsOnAllReports();
    }
    
    private int getArrayIndex(int index) {